-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BeamBase, Beam and TremoloTwoChord refactor #24820
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work! A few thoughts:
src/engraving/dom/beambase.h
Outdated
void setDirection(DirectionV val) { m_direction = val; } | ||
virtual void setBeamDirection(DirectionV v) = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This combination of methods looks potentially confusing. I'd rename setDirection
to doSetDirection
and make it protected; then rename setBeamDirection
to setDirection
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed the names but doSetDirection
needs to remain public for its use in TremoloLayout::layoutTwoNotesTremolo
// idx 0 - DirectionV::AUTO or DirectionV::DOWN | ||
// 1 - DirectionV::UP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: I've always found "auto/down" vs "up" a strange classification and never understood why we'd ever treat "auto" as "down". But that's probably for another day.
0ad826b
to
09c15e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, thank you!
I spotted a lot of duplicated code between
Beam
andTremoloTwoChord
. I've unified this inBeamBase
. This is mostly completely straightforward, with the exception ofclearBeamSegments
andsetBeamDirection
which need overriden methods to deal with the different numbers of chords expected on each beam.It also looks like there's some leftover dead code from when two note and one note tremolos were a single class. I haven't tackled that in this PR, but we can slim the
TremoloTwoChord
class down even further in future.